<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浏览器卷去的尺寸</title>
    <style>
        body {
            height: 3000px;
            width: 2000px;
        }
    </style>
</head>
<body>

<script>
    // 获得卷去的高度
    var h = document.documentElement.scrollTop;
    console.log(h)
    //卷去的宽度
    var w = document.documentElement.scrollLeft;
    console.log(w);
    /*
    没有<!DOCTYPE html>获得
    document.body.scrollTop
    document.body.scrollLeft
    */
</script>
</body>
</html>